using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace CMS_GYM
{
    public class clsNguoiDungDTO
    {
        #region "Variables And Properties"
        #region Int UserID
        int _userID = 0;
        public int UserID
        {
            get { return _userID; }
            set { _userID = value; }
        }
        #endregion

        #region String Login
        string _login = string.Empty;
        public string Login
        {
            get { return _login; }
            set { _login = value; }
        }
        #endregion

        #region String UserName
        string _userName = string.Empty;
        public string UserName
        {
            get { return _userName; }
            set { _userName = value; }
        }
        #endregion

        #region String PW
        string _pw = string.Empty;
        public string PW
        {
            get { return _pw; }
            set { _pw = value; }
        }
        #endregion

        #region Bool Locked
        bool _locked = false;
        public bool Locked
        {
            get { return _locked; }
            set { _locked = value; }
        }
        #endregion
        #endregion

        #region "Constructors"
        #region Users()
        public clsNguoiDungDTO()
        {
            _userID = 0;
            _login = string.Empty;
            _userName = string.Empty;
            _pw = string.Empty;
            _locked = false;
        }
        #endregion
        #endregion

        #region GetUserInfo(DataRow dr)
        public void GetUserInfo(DataRow dr)
        {
            try
            {
                _userID = 0;
                _login = string.Empty;
                _userName = string.Empty;
                _pw = string.Empty;
                _locked = false;

                _userID = int.Parse(dr["UserID"].ToString());
                if (dr.Table.Columns.Contains("Login")) _login = dr["Login"].ToString();
                if (dr.Table.Columns.Contains("UserName")) _userName = dr["UserName"].ToString();
                if (dr.Table.Columns.Contains("PW")) _pw = dr["PW"].ToString();
                if (dr.Table.Columns.Contains("Locked")) _locked = bool.Parse(dr["Locked"].ToString());
            }
            catch
            {
                _userID = 0;
                _login = string.Empty;
                _userName = string.Empty;
                _pw = string.Empty;
                _locked = false;
            }
            return;
        }
        #endregion 
    }
}
